﻿namespace _02.HumanStudentExercise
{
    using System;
    using System.Collections.Generic;
    using System.Linq;

    class HumanStudentExercise
    {
        static void Main()
        {
            List<Student> students = new List<Student>();
            students.Add(new Student("Kiril", "Pehlivanov", 2));
            students.Add(new Student("Mara", "Boteva", 3));
            students.Add(new Student("Ivan", "Ivanov", 6));
            students.Add(new Student("Petio", "Banev", 2));
            students.Add(new Student("Irena", "Mineva", 2));
            students.Add(new Student("Katia", "Asenova", 4));
            students.Add(new Student("Plamen", "Plamenov", 2));
            students.Add(new Student("Sasho", "Konov", 3));
            students.Add(new Student("Ilko", "Ognyanov", 5));
            students.Add(new Student("Tamara", "Kostova", 3));

            students = students.OrderBy(student => student.Grade).ToList();
            Console.WriteLine("Students: ");
            foreach (var student in students)
            {
                Console.WriteLine(student);
            }
            Console.WriteLine();

            List<Worker> workers = new List<Worker>();
            workers.Add(new Worker("Pensho", "Petrov", 500, 8));
            workers.Add(new Worker("Mincho", "Praznikov", 1000, 4));
            workers.Add(new Worker("Metodi", "Munchev", 230, 6));
            workers.Add(new Worker("Penka", "Daskalova", 235, 11));
            workers.Add(new Worker("Maria", "Ignatova", 320, 8));
            workers.Add(new Worker("Stanislava", "Subeva", 500, 10));
            workers.Add(new Worker("Ivelina", "Kadjiiska", 100, 8));
            workers.Add(new Worker("Ivan", "Petrov", 500, 3));
            workers.Add(new Worker("Dragan", "Tsankov", 500, 8));
            workers.Add(new Worker("Vladimir", "Vazov", 800, 15));

            workers = workers.OrderByDescending(worker => worker.MoneyPerHour()).ToList();
            Console.WriteLine("Workers: ");
            foreach (var worker in workers)
            {
                Console.WriteLine(worker);
            }
            Console.WriteLine();

            // Merge the two lists
            var humanList = students.Concat<Human>(workers);
            humanList = humanList.OrderBy(list => list.FirstName).ThenBy(list => list.LastName).ToList();

            Console.WriteLine("Humans: ");
            foreach (var human in humanList)
            {
                Console.WriteLine(human);
            }
        }
    }
}
